﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace openapi_sdk_v3
{
    internal class aliyun
    {
        //阿里云泛化调用
        public static AlibabaCloud.OpenApiClient.Models.Params CreateApiInfo(string action, string version, string protocol, string method, string authType, string style, string pathname, string reqBodyType, string bodyType)
        {
            AlibabaCloud.OpenApiClient.Models.Params params_ = new AlibabaCloud.OpenApiClient.Models.Params
            {
                // 接口名称
                Action = action,
                // 接口版本
                Version = version,
                // 接口协议
                Protocol = protocol,
                // 接口 HTTP 方法
                Method = method,
                AuthType = authType,
                Style = style,
                // 接口 PATH
                Pathname = pathname,
                // 接口请求体内容格式
                ReqBodyType = reqBodyType,
                // 接口响应体内容格式
                BodyType = bodyType,
            };
            return params_;
        }


        public static AlibabaCloud.OpenApiClient.Client CreateClient(string accessKeyId, string accessKeySecret)
        {
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config
            {
                // 必填，您的 AccessKey ID
                AccessKeyId = accessKeyId,
                // 必填，您的 AccessKey Secret
                AccessKeySecret = accessKeySecret,
            };
            // Endpoint 请参考 https://api.aliyun.com/product/ImageSearch
            config.Endpoint = "imagesearch.cn-hangzhou.aliyuncs.com";
            return new AlibabaCloud.OpenApiClient.Client(config);
        }
    }
}
